<!--上传文件-->
<link rel="stylesheet" href="__STATIC__/admin/css/edit_common.css">

<link rel="stylesheet"type="text/css"href="__STATIC__/admin/uploadify/uploadify.css" />

<link rel="stylesheet" type="text/css" href="__CSS__/plyr.css"/>

<style>
    #commodity_main input[type=text]{width: 98%;}
    #commodity_main input[type=file]{margin-bottom: 10px;}
    #commodity_main img{width: 120px;height: 120px;border-radius: 50%;background-color: #FFFFFF;border-color:#FFFFFF;}
</style>

<div id="commodity_details">
    <h1 style="margin-top: 0px!important;">
        <img src="__STATIC__/admin/img/ico.png">
        编辑
        <a href="javascript:history.go(-1);"><span><img src="__STATIC__/admin/img/return.png"></span></a>
    </h1>
    </h1>
</div>

<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <form class="form-horizontal" role="form" method="post" url="{:url()}" id="edit_form">
                <input type="hidden" name="id" value="{$item['id']}">
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 名称 </label>
                    <div class="col-sm-9">
                        <input type="text" class="col-xs-10 col-sm-5" name="name" value="{$item['name']}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 图片 </label>
                    <div class="col-sm-9">
                        <input id="file_upload"  type="file" multiple="true" >
                        <img id="upload_org_code_img" src="{$item['image']}" width="150" height="150">
                        <input id="file_upload_image" name="image" type="hidden" multiple="true" value="{$item['image']}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 遮罩层名称 </label>
                    <div class="col-sm-9">
                        <input type="text" class="col-xs-10 col-sm-5" name="center_name" value="{$item['center_name']}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 日期 </label>
                    <div class="col-sm-9">
                        <input type="text" class="col-xs-10 col-sm-5" name="date" value="{$item['date']}"/>
                    </div>
                </div>
                {if condition="0 EQ $item['type']"}
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right"> 内容 </label>
                        <div class="col-sm-9">
                            <textarea name="content" id="content_" cols="30" rows="10">{$item['content']}</textarea>
                        </div>
                    </div>
                    {else/}
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right"> 视频 </label>
                        <div class="col-sm-9">
                            <input id="file_upload2"  type="file" multiple="true" >
                            <input id="file_upload_image2" name="content" type="hidden" multiple="true" value="{$item['content']}">
                            <!--<div>-->
                                <!--<div class="row video" >-->
                                    <!--<div tabindex="0" class="plyr plyr&#45;&#45;video plyr&#45;&#45;fullscreen-enabled plyr&#45;&#45;stopped plyr&#45;&#45;ready">-->
                                        <!--<div class="plyr__video-wrapper" style="cursor: pointer;">-->
                                            <!--<div class="plyr__captions"></div>-->
                                            <!--<video class="embed-responsive-item plyr&#45;&#45;setup" poster="">-->
                                                <!--<source id="upload_org_code_img2" src="{$config['config_value']}" type="video/mp4">-->
                                            <!--</video>-->
                                        <!--</div>-->
                                        <!--<button type="button" data-plyr="play" class="plyr__play-large" aria-label="Play"><svg><use xlink:href="#plyr-play"></use></svg><span class="plyr__sr-only">Play</span></button>-->
                                        <!--<div class="plyr__controls"><button type="button" data-plyr="play" aria-label="Play"><svg><use xlink:href="#plyr-play"></use></svg><span class="plyr__sr-only">Play</span></button><button type="button" data-plyr="pause"><svg><use xlink:href="#plyr-pause"></use></svg><span class="plyr__sr-only">Pause</span></button><span class="plyr__progress"><label for="seek6523" class="plyr__sr-only">Seek</label><input id="seek6523" class="plyr__progress&#45;&#45;seek" type="range" min="0" max="100" step="0.1" value="0" data-plyr="seek"><progress class="plyr__progress&#45;&#45;played" max="100" value="0" role="presentation"></progress><progress class="plyr__progress&#45;&#45;buffer" max="100" value="7.05"><span>7.05</span>% buffered</progress><span class="plyr__tooltip">00:00</span></span><span class="plyr__time"><span class="plyr__sr-only">Current time</span><span class="plyr__time&#45;&#45;current">00:39</span></span><button type="button" data-plyr="mute" aria-pressed="false"><svg class="icon&#45;&#45;muted"><use xlink:href="#plyr-muted"></use></svg><svg><use xlink:href="#plyr-volume"></use></svg><span class="plyr__sr-only">Toggle Mute</span></button><span class="plyr__volume"><label for="volume6523" class="plyr__sr-only">Volume</label><input id="volume6523" class="plyr__volume&#45;&#45;input" type="range" min="0" max="10" value="10" data-plyr="volume"><progress class="plyr__volume&#45;&#45;display" max="10" value="10" role="presentation"></progress></span><button type="button" data-plyr="captions"><svg class="icon&#45;&#45;captions-on"><use xlink:href="#plyr-captions-on"></use></svg><svg><use xlink:href="#plyr-captions-off"></use></svg><span class="plyr__sr-only">Toggle Captions</span></button><button type="button" data-plyr="fullscreen" aria-pressed="false"><svg class="icon&#45;&#45;exit-fullscreen"><use xlink:href="#plyr-exit-fullscreen"></use></svg><svg><use xlink:href="#plyr-enter-fullscreen"></use></svg><span class="plyr__sr-only">Toggle Fullscreen</span></button></div>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->
                        </div>
                    </div>
                {/if}

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="button" id="lg_button">
                            <i class="icon-ok bigger-110"></i>
                            保存
                        </button>
                    </div>
                </div>
            </form>
        </div><!-- /.col -->
    </div><!-- /.row -->
</div><!-- /.page-content -->

{load href="__STATIC__/admin/js/image.js" /}
<script>
    $(".gs").addClass("active open");
    $(".gs .xm").addClass("active");
    $("#lg_button").click(function(){
        $.ajax({
            type: 'POST',
            url: "{:url('')}",
            data: $('#edit_form').serialize(),
            dataType: "json",
            success: function(data) {
                var result = eval(data);
                alert(result.message);
                if (result.status == 0) {
                    location.href = "{:url('story/itemList')}";
                }
            }
        });
    });
</script>

<!-- 配置文件 -->
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.all.js"></script>
<!--编辑器语言加载-->
<script type="text/javascript" src="__STATIC__/ueditor/lang/zh-cn/zh-cn.js"></script>

<link type="text/css" rel="stylesheet" href="__STATIC__/ueditor/third-party/video-js/video-js.css"/>
<script language="javascript" type="text/javascript" src="__STATIC__/ueditor/third-party/video-js/video.js"></script>

<!-- 实例化编辑器 -->
<script type="text/javascript">
    let config = {
        initialFrameWidth: "100%", //初化宽度
        initialFrameHeight: 200, //初化高度
        serverUrl: "{$server_url}",
        maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
        toolbars: [
            ['fullscreen', 'source', '|', 'undo', 'redo','|', 'bold', 'italic', 'underline', 'fontborder',
                'strikethrough', 'removeformat', 'formatmatch', 'autotypeset',
                'blockquote', 'pasteplain', '|', 'forecolor','backcolor', 'insertorderedlist',
                'insertunorderedlist', 'selectall', 'cleardoc', '|','rowspacingtop', 'rowspacingbottom',
                'lineheight', '|','customstyle', 'paragraph', 'fontfamily', 'fontsize','|','indent' , 'justifyleft', 'justifycenter','justifyright',
                'justifyjustify',  '|', 'link', 'unlink', 'horizontal', 'simpleupload']
        ]
    };
    let ue = UE.getEditor('content_',config);
</script>